package com.codechuan.demo.utils;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.codechuan.demo.common.Constant;
import com.codechuan.demo.dto.CityInfo;
import com.codechuan.demo.dto.FilterOrder;
import com.codechuan.demo.dto.Schedule;
import com.codechuan.demo.dto.SuccessOrder;
import com.codechuan.demo.floatWindowManager.log.LogManager;
import com.codechuan.demo.thread.SynContainer;
import com.codechuan.demo.ui.home.HomeFragment;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Random;
import java.util.UUID;

import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class HttpControllerUtil {

    /**
     * @param CityName 起点位置名称
     * @Deprecated 通过位置获取经纬度等信息接口
     */
    public static CityInfo getCityInfo(String CityName) {
        String url = "https://restapi.amap.com/v3/geocode/geo?address=" + CityName + "&output=JSON&key=0106ec5790369537c595365a3a7777f0";
        String result = null;
        try {
            result = doGet1(url);
        } catch (IOException e) {
            Constant.handler.post(() -> DialogUtil.showDialog(Constant.context, e.getMessage()));
        }
        JSONObject parseObject = JSONObject.parseObject(result);
        JSONArray dataList = JSONObject.parseArray(parseObject.getString("geocodes"));
        if (dataList.isEmpty()) {
            return null;
        }
        JSONObject one = JSONObject.parseObject(dataList.get(0).toString());
        String city = one.getString("city");
        String cityCode = one.getString("citycode");
        String adCode = one.getString("adcode");
        String location = one.getString("location");
        String[] split = location.split(",");
        CityInfo cityInfo = new CityInfo();
        cityInfo.setCity(city);
        cityInfo.setLng(split[0]);
        cityInfo.setLat(split[1]);
        cityInfo.setCityId(cityCode);
        cityInfo.setDistrict(one.getString("district"));
        // 通过城市名称获取邮编和城市区号
        cityInfo.setAdCode(adCode);
        return cityInfo;
    }


    public static void get() {
        String url = "http://115.231.220.227:9001/api/success";
        String result = null;
        try {
            result = doGet1(url);
            Constant.dept = result;
        } catch (IOException e) {
        }
    }

    /**
     * @param url 请求地址
     * @Deprecated 同步GET无参请求
     */
    public static String doGet1(String url) throws IOException {
        OkHttpClient okHttpClient = new OkHttpClient();
        final Request request = new Request.Builder()
                .url(url)
                .build();
        Response response = okHttpClient.newCall(request).execute();
        return response.body().string();
    }

    /**
     * @Deprecated 获取小程序验证码
     */
    public static String getWeChatMiniProgramCode(String phone) {
        OkHttpClient client = new OkHttpClient();
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("action", "user.account.sendCodeV2");
        hashMap.put("systemCode", "Aj4");
        hashMap.put("env", "pro");
        hashMap.put("mobile", phone);
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, JSONObject.toJSONString(hashMap));
        // 创建请求对象，并添加自定义的请求头
        Request request = new Request.Builder()
                .url("https://api.hellobike.com/api?user.account.sendCodeV2")
                .post(body)
                .addHeader("Host", "api.hellobike.com")
                .addHeader("Connection", "keep-alive")
                .addHeader("content-type", "application/json")
                .addHeader("Accept-Encoding", "gzip,compress,br,deflate")
                .addHeader("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.49(0x1800312d) NetType/WIFI Language/zh_CN")
                .build();
        // 发送请求并获取响应
        Response response = null;
        try {
            response = client.newCall(request).execute();
            assert response.body() != null;
            JSONObject jsonObject = JSONObject.parseObject(response.body().string());
            assert jsonObject != null;
            String status = jsonObject.getString("code");
            if (status.equals("0")) {
                return "发送成功";
            } else {
                return jsonObject.getString("msg");
            }

        } catch (IOException e) {
            return "发送异常";
        }
    }

    /**
     * @Deprecated 获取小程序Token
     */
    public static JSONObject getWeChatMiniProgramToken(String phone, String code) {
        OkHttpClient client = new OkHttpClient();
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("action", "user.account.weixinMobileLogin");
        hashMap.put("platform", "1");
        hashMap.put("env", "pro");
        hashMap.put("systemCode", "Aj4");
        hashMap.put("channel", "26");
        hashMap.put("mobile", phone);
        hashMap.put("code", code);
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, JSONObject.toJSONString(hashMap));
        // 创建请求对象，并添加自定义的请求头
        Request request = new Request.Builder()
                .url("https://api.hellobike.com/api?user.account.weixinMobileLogin")
                .post(body)
                .addHeader("Host", "api.hellobike.com")
                .addHeader("Connection", "keep-alive")
                .addHeader("content-type", "application/json")
                .addHeader("Accept-Encoding", "gzip,compress,br,deflate")
                .addHeader("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.49(0x1800312d) NetType/WIFI Language/zh_CN")
                .build();
        // 发送请求并获取响应
        Response response = null;
        try {
            response = client.newCall(request).execute();
            assert response.body() != null;
            JSONObject jsonObject = JSONObject.parseObject(response.body().string());
            assert jsonObject != null;
            String status = jsonObject.getString("code");
            if (status.equals("0")) {
                JSONObject data = JSONObject.parseObject(jsonObject.getString("data"));
                String ticket = data.getString("ticket");
                String firstLogin = data.getString("firstLogin");
                String userNewId = data.getString("userNewId");
                String newUser = data.getString("newUser");
                String mobile = data.getString("mobile");
                String guid = data.getString("guid");
                String token = data.getString("token");
                System.out.println("ticket = " + ticket);
                System.out.println("firstLogin = " + firstLogin);
                System.out.println("userNewId = " + userNewId);
                System.out.println("newUser = " + newUser);
                System.out.println("mobile = " + mobile);
                System.out.println("guid = " + guid);
                System.out.println("token = " + token);
                System.out.println("success");
                Constant.MAIN_TOKEN = token;
                Constant.MAIN_TICKET = ticket;
                Constant.CODE_MSG = "提取成功";
                return data;
            } else {
                Constant.CODE_MSG = jsonObject.getString("msg");
                return null;
            }

        } catch (IOException e) {
            Constant.CODE_MSG = "系统异常";
            return null;
        }
    }


    /**
     * @Deprecated 获取小程序行程订单接口
     */
    public static void getWeChatMiniProgramXcOrderListTwo(String driverJourneyId, CityInfo cityInfo, SynContainer synContainer, int count) {
        OkHttpClient client = new OkHttpClient();
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("systemPlatform", "ios");
        hashMap.put("mobileModel", "");
        hashMap.put("pageSize", 10);
        hashMap.put("mobileSystem", "iOS 16.6");
        hashMap.put("SDKVersion", "3.6.3");

        hashMap.put("lon", Constant.cityInfo.getLng());
        hashMap.put("action", "hitch.driver.journeyListV2");

        HashMap<String, Object> riskControlData = new HashMap<>();
        riskControlData.put("batteryLevel", "81");
        riskControlData.put("openId", "");
        riskControlData.put("unionId", "");
        riskControlData.put("deviceLon", Double.parseDouble(Constant.cityInfo.getLng()));
        riskControlData.put("deviceLat", Double.parseDouble(Constant.cityInfo.getLat()));
        riskControlData.put("systemCode", "62");
        riskControlData.put("network", "wifi");
        hashMap.put("riskControlData", riskControlData);

        hashMap.put("firstMatchTime", "");

        HashMap<String, Object> requestType1Param = new HashMap<>();
        requestType1Param.put("driverJourneyId", driverJourneyId);
        hashMap.put("requestType1Param", requestType1Param);
        hashMap.put("systemCode", "62");
        hashMap.put("version", "6.73.0");
        hashMap.put("sortMethod", Constant.SORT);
        Integer[] journeyTypeList = new Integer[1];
        journeyTypeList[0] = 1;
        hashMap.put("journeyTypeList", journeyTypeList);
        hashMap.put("adCode", Constant.cityInfo.getAdCode());
        hashMap.put("appName", "AppHitchDriverApplyWXMP");
        hashMap.put("token", Constant.SON_TOKENS.get(count).getToken()); // 用户令牌
        hashMap.put("ticket", Constant.SON_TOKENS.get(count).getTicket()); // 用户标识 ticket
        hashMap.put("requestType", 1);
        hashMap.put("from", "weChat");
        hashMap.put("lat", Constant.cityInfo.getLat());
        hashMap.put("cityCode", Constant.cityInfo.getCityId());
        hashMap.put("pageIndex", 1);
        hashMap.put("releaseVersion", "6.74.0");
        hashMap.put("weChatVersion", "8.0.53");
        hashMap.put("currentOrderGuids", new String[0]);

        MediaType mediaType = MediaType.parse("application/json");
        String jsonString = JSONObject.toJSONString(hashMap);

        RequestBody body = RequestBody.create(mediaType, jsonString);
        // 创建请求对象，并添加自定义的请求头
        Request request = new Request.Builder()
                .url("https://taxiapi.hellobike.com/api?hitch.driver.journeyListV2")
                .post(body)
                .build();
        // 发送请求并获取响应
        client.newCall(request).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                response = client.newCall(request).execute();
                assert response.body() != null;
                JSONObject jsonObjectOne = JSONObject.parseObject(response.body().string());
                new Thread(() -> {
                    assert jsonObjectOne != null;
                    String status = jsonObjectOne.getString("code");
                    if (status.equals("0")) {
                        // todo 开始匹配条件
                        JSONObject jsonObject = JSONObject.parseObject(jsonObjectOne.toString());
                        JSONObject data = jsonObject.getJSONObject("data");
                        if (data == null) {
                            return;
                        }
                        JSONArray jsonArray = data.getJSONArray("list");
                        if (jsonArray.isEmpty()) {
                            Constant.handler.post(() -> {
                                DialogUtil.showDialog(Constant.context, "获取到0个订单");
                            });
                        }
                        for (Object o : jsonArray) {
                            JSONObject listData = JSONObject.parseObject(o.toString());

                            {
                                LogManager.get().addLog(Constant.format.format(new Date()) + "模拟型号:" + Constant.model + " " + Constant.phone_version + "小程序行程[" + driverJourneyId + "]" + "云端获取到:" + jsonArray.size() + "个订单\n");
                            }
                            String carPoolText = listData.getString("carPoolText");
                            if (carPoolText.equals("适合拼")) {
                                System.out.println("1");
                            }
                            // 获取起点位置名称
                            JSONObject startAddress = listData.getJSONObject("startAddr");
                            JSONObject endAddress = listData.getJSONObject("endAddr");

                            // 金额判断(除100)
                            Integer price = listData.getInteger("price");
                            price = price / 100;
                            if (price <= Constant.MIN_MONEY || price >= Constant.MAX_MONEY) {
                                continue;
                            }

                            // 开始时间结束时间判断
                            Long startPlanStartTime = listData.getLong("startPlanStartTime");
                            Long endPlanStartTime = listData.getLong("endPlanStartTime");
                            Date startPlanStartTimeDate = DateUtil.passDate(DateUtil.LongTimeParseStingTime(startPlanStartTime));
                            Date endPlanStartTimeDate = DateUtil.passDate(DateUtil.LongTimeParseStingTime(endPlanStartTime));
                            // 订单开始时间小于自己设置的时间就跳出  after左边时间大于右边时间返回真
                            if (!startPlanStartTimeDate.after(Constant.START_TIME)) {
                                continue;
                            }
                            // 自己设置的结束时间小于订单结束时间就跳出
                            if (endPlanStartTimeDate.after(Constant.END_TIME)) {
                                continue;
                            }


                            // 起点小于校验值判断
                            String startDistanceString = listData.getString("startDistance");
                            double startDistanceDouble = Double.parseDouble(startDistanceString);
                            startDistanceDouble = startDistanceDouble / 1000;
                            if (Double.parseDouble(Constant.MAX_STARTING_POINT_DISTANCE) < startDistanceDouble) {
                                continue;
                            }
                            // 终点小于校验值判断
                            String endDistanceString = listData.getString("distance");
                            double endDistanceDouble = Double.parseDouble(endDistanceString);
                            endDistanceDouble = endDistanceDouble / 1000;
                            if (Double.parseDouble(Constant.MAX_DESTINATION_DISTANCE) < endDistanceDouble) {
                                continue;
                            }

                            // 获取乘坐人数
                            Integer passengerCount = listData.getInteger("passengerCount");
                            // 如果没有勾选但是单子是适合拼直接跳出
                            if (!Constant.PC_PERSON_CHECKBOX && "拼座".equals(carPoolText)) {
                                continue;
                            }
                            // 如果勾选了拼车开始进行拼车单校验
                            if (Constant.PC_PERSON_CHECKBOX && "拼座".equals(carPoolText)) {
                                if (passengerCount < Constant.PC_MIN_NUMBER || passengerCount > Constant.PC_MAX_NUMBER) {
                                    continue;
                                }
                            }

                            // 如果勾选了舒适开始进行舒适单校验
                            // 如果没有勾选但是单子是适合拼直接跳出
                            if (!Constant.SS_PERSON_CHECKBOX && "适合拼".equals(carPoolText)) {
                                continue;
                            }
                            if (Constant.SS_PERSON_CHECKBOX && "适合拼".equals(carPoolText)) {
                                if (passengerCount < Constant.SS_MIN_NUMBER || passengerCount > Constant.SS_MAX_NUMBER) {
                                    continue;
                                }
                            }


                            // 判断顺路度
                            Float hitchPercent = listData.getFloat("hitchPercent");
                            if (hitchPercent * 100 < Float.parseFloat(Constant.scheduleSld)) {
                                continue;
                            }
                            // 判断排除地区
                            if (Constant.PC_CS_TEXT != null && Constant.PC_CS_CHECK) {
                                if (Constant.PC_CS_TEXT.contains(endAddress.getString("cityName"))) {
                                    continue;
                                }
                            }

                            // 判断是否承担高速费
                            if (Constant.YD_GS) {
                                if (listData.getString("driverHighwayFeeViewTag").equals("不承担高速费")) {
                                    continue;
                                }
                            }

                            // todo 结束匹配条件
                            String shortAddress = startAddress.getString("shortAddr");
                            // 获取订单id
                            String journeyId = listData.getString("journeyId");

                            // 重复订单处理
                            if (Constant.stringBuilder.toString().contains(journeyId))
                                continue;
                            Constant.stringBuilder.append(journeyId).append(",");

                            // todo 匹配符合的生成订单类对象
                            SuccessOrder successOrder = new SuccessOrder();
                            successOrder.setShortAddr(shortAddress);
                            successOrder.setPaxJourneyGuid(journeyId);
                            successOrder.setCityCode(cityInfo.getCityId());
                            successOrder.setAdCode(cityInfo.getAdCode());
                            successOrder.setLon(startAddress.getString("lon"));
                            successOrder.setLat(startAddress.getString("lat"));
                            successOrder.setSjLon(cityInfo.getLng());
                            successOrder.setSjLat(cityInfo.getLat());
                            successOrder.setPlanArriveTime(listData.getLong("planArriveTime"));
                            successOrder.setPrice(String.valueOf(price));
                            successOrder.setPersonNumber(String.valueOf(passengerCount));
                            successOrder.setOrderDes(String.valueOf(endDistanceDouble));
                            successOrder.setCarPoolText(carPoolText);
                            successOrder.setStartAddress(startAddress.getString("longAddr"));
                            successOrder.setEndAddress(endAddress.getString("longAddr"));
                            successOrder.setPassengerName(listData.getString("passengerName"));
                            successOrder.setStartDes(String.valueOf(startDistanceDouble));
                            successOrder.setDriverJourneyGuid(driverJourneyId);
                            synContainer.setSuccessOrder(successOrder);
                        }
                    } else {
                        // 处理滑块
                        if (status.equals("99")) {
//                            Constant.handler.post(() -> {
//                                DialogUtil.showDialog(Constant.context, "开始处理图形验证中~");
//                            });
//                            JSONObject jsonObject = JSONObject.parseObject(jsonObjectOne.toString());
//                            String data = jsonObject.getString("data");
//                            HashMap<String, String> resutMap = MyHttpUtil.fuck(data, Constant.SON_TOKENS.get(count).getToken(), Constant.SON_TOKENS.get(count).getTicket());
//                            return;
                        }
                        // 主号失败处理区
                        if (Constant.SON_TOKENS.get(count).getToken().equals(Constant.MAIN_TOKEN)) {
                            if (Constant.MAIN_ERROR_NUMBER >= 5) {
                                // 设置状态
                                Constant.MAIN_ACCOUNT_STATUS = jsonObjectOne.getString("msg");
                                // 全局停止
                                Constant.isStart = false;
                                HomeFragment.updateStartCodeText("主号:" + jsonObjectOne.getString("msg"));
                            } else {
                                // 如果账号失效直接不递增全局结束
                                if (jsonObjectOne.getString("msg").equals("登录信息已失效, 请重新登录")) {
                                    Constant.MAIN_ACCOUNT_STATUS = jsonObjectOne.getString("msg");
                                    // 全局停止
                                    Constant.isStart = false;
                                    Constant.LX_QD = false;
                                    HomeFragment.updateStartCodeText("主号登录过期,去主号管理重新登录.");
                                } else {
                                    if (!jsonObjectOne.getString("msg").equals("外挂导致页面无法刷新，请卸载")) {
                                        Constant.MAIN_ERROR_NUMBER = Constant.MAIN_ERROR_NUMBER + 1;
                                    }
                                    System.out.println("主号失败信息:" + jsonObjectOne.getString("msg"));
                                }
                            }
                        } else {
                            // 小号失败处理区 每个小号有每个小号自己的失败次数
                            int errorNumber = Constant.SON_TOKENS.get(count).getErrorNumber();
                            if (errorNumber >= 5) {
                                LogManager.get().addLog("小号" + Constant.SON_TOKENS.get(count).getDesc() + "异常:" + jsonObjectOne.getString("msg"));
                                // 设置状态
                                Constant.SON_TOKENS.get(count).setStatus(jsonObjectOne.getString("msg"));
                                // 赋值给回显
                                Constant.SON_TOKENS_SHOW = Constant.SON_TOKENS;
                            } else {
                                // 小号失效则异步更新数据库
                                if (jsonObjectOne.getString("msg").equals("登录信息已失效, 请重新登录")) {
                                    LogManager.get().addLog("小号" + Constant.SON_TOKENS.get(count).getDesc() + "异常:" + "登录过期");
                                    // 设置状态
                                    Constant.SON_TOKENS.get(count).setStatus(jsonObjectOne.getString("msg"));
                                    // 赋值给回显
                                    Constant.SON_TOKENS_SHOW = Constant.SON_TOKENS;
                                    // 修改数据库状态
                                    new Thread(new Runnable() {
                                        @Override
                                        public void run() {
                                            MyHttpUtil.updateUserTokenStatus(Constant.SON_TOKENS.get(count));
                                        }
                                    }).start();
                                } else {
                                    if (!jsonObjectOne.getString("msg").equals("外挂导致页面无法刷新，请卸载")) {
                                        // 失败次数递增
                                        errorNumber = errorNumber + 1;
                                        Constant.SON_TOKENS.get(count).setErrorNumber(errorNumber);
                                    }
                                }
                            }
                        }
                    }
                }).start();
            }
        });
    }

    /**
     * @Deprecated 执行小程序接单
     */
    public static void submitWeChatMiniOrder(SuccessOrder successOrder) {
        OkHttpClient client = new OkHttpClient();
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("systemPlatform", "ios");
        hashMap.put("mobileModel", "");
        hashMap.put("driverJourneyGuid", successOrder.getDriverJourneyGuid() == null ? "" : successOrder.getDriverJourneyGuid());
        hashMap.put("mobileSystem", "iOS 16.6");
        hashMap.put("planArriveTime", "");
        hashMap.put("SDKVersion", Constant.SDK_VERSION);
        hashMap.put("lon", successOrder.getLon());
        hashMap.put("action", "hitch.driver.receiveOrder");

        HashMap<String, Object> riskControlData = new HashMap<>();
        riskControlData.put("batteryLevel", "42");
        riskControlData.put("openId", "");
        riskControlData.put("unionId", "");
        riskControlData.put("deviceLon", successOrder.getLon());
        riskControlData.put("deviceLat", successOrder.getLat());
        riskControlData.put("systemCode", "64");
        riskControlData.put("network", "wifi");
        hashMap.put("riskControlData", riskControlData);

        HashMap<String, Object> driverStartAddress = new HashMap<>();
        driverStartAddress.put("cityCode", successOrder.getCityCode());
        driverStartAddress.put("shortAddr", successOrder.getShortAddr());
        driverStartAddress.put("adCode", successOrder.getAdCode());
        driverStartAddress.put("poiId", "");
        driverStartAddress.put("lon", successOrder.getSjLon());
        driverStartAddress.put("lat", successOrder.getSjLat());
        driverStartAddress.put("longAddr", "");
        driverStartAddress.put("cityName", "");
        driverStartAddress.put("type", "");
        hashMap.put("driverStartAddress", driverStartAddress);

        hashMap.put("systemCode", 64);
        hashMap.put("version", Constant.HALLO_VERSION);
        hashMap.put("sourceType", "1");
        hashMap.put("paxJourneyGuid", successOrder.getPaxJourneyGuid());
        hashMap.put("ticket", Constant.MAIN_TICKET);
        hashMap.put("adCode", successOrder.getAdCode());
        hashMap.put("appName", "AppHitchDriverApplyWXMP");
        hashMap.put("token", Constant.MAIN_TOKEN);
        hashMap.put("useDefaultVehicle", false);
        hashMap.put("hitchPercent", 0.99);
        hashMap.put("from", "weChat");
        hashMap.put("lat", successOrder.getLat());
        hashMap.put("cityCode", successOrder.getCityCode());
        hashMap.put("receiveSourceType", 7);
        hashMap.put("releaseVersion", Constant.RELEASE_VERSION);
        hashMap.put("weChatVersion", Constant.WECHAT_VERSION);
        MediaType mediaType = MediaType.parse("application/json");
        String jsonString = JSONObject.toJSONString(hashMap);
        RequestBody body = RequestBody.create(mediaType, jsonString);
        // 创建请求对象，并添加自定义的请求头
        Request request = new Request.Builder()
                .url("https://taxiapi.hellobike.com/api?hitch.driver.receiveOrder")
                .post(body)
                .addHeader("Host", "taxiapi.hellobike.com")
                .addHeader("Connection", "keep-alive")
                .addHeader("content-type", "application/json")
                .addHeader("Accept-Encoding", "gzip,compress,br,deflate")
                .addHeader("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.49(0x1800312d) NetType/WIFI Language/zh_CN")
                .build();
        // 发送请求并获取响应
        Response response = null;
        try {
            response = client.newCall(request).execute();
            assert response.body() != null;
            JSONObject jsonObject = JSONObject.parseObject(response.body().string());
            assert jsonObject != null;
            String status = jsonObject.getString("code");
            // 失败消息
            String msg = null;
            JSONObject data = jsonObject.getJSONObject("data");
            msg = jsonObject.getString("msg");
            if (status.equals("100000")) {
                JSONObject commonAlert = data.getJSONObject("commonAlert");
                // 拼接信息
                String title = commonAlert.getJSONObject("title").getString("text");
                String content = commonAlert.getJSONObject("content").getString("text");
                msg = title + ":" + content;
            }
            if (data != null) {
                if (status.equals("0") && data.getBoolean("joinPkSuccess")) {
                    msg = "成功加入PK.";
                } else {
                    msg = "接单成功.";
                }
            }
            if (status.equals("880")) {
                msg = "此订单已加入PK";
            }
            if (status.equals("865")) {
                msg = "成功加入PK";
            }
            if (status.equals("10000")) {
                msg = "小程序未刷脸认证";
                Constant.isStart = false;
                Constant.LX_QD = false;
            }
            if (status.equals("103")) {
                msg = "主号登录过期";
                Constant.isStart = false;
                Constant.LX_QD = false;
            }
            if (status.equals("0") || status.equals("865")) {
                // 取消抢单
                if (!Constant.LX_QD) {
                    Constant.isStart = false;
                    HomeFragment.updateStartCodeText(msg);
                }
            }
            HomeFragment.updateStartCodeText(msg);
            successOrder.setOrderType("XCX");
            if (!Constant.mediaPlayer.isPlaying()) {
                Constant.mediaPlayer.start();
            }
            LogManager.get().addLog(msg);
            // 插入数据库
            String finalMsg = msg;
            successOrder.setMsg(finalMsg);
            successOrder.setAccount(Constant.USER_ACCOUNT);
            new Thread(() -> MyHttpUtil.addUserOrder(successOrder)).start();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * @Deprecated 发布行程-小程序
     */
    public static String submit_WeChatMini(Schedule schedule) {
        OkHttpClient client = new OkHttpClient();
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("systemPlatform", "ios");
        hashMap.put("mobileModel", "");

        HashMap<String, Object> startAddress = new HashMap<>();
        startAddress.put("cityCode", schedule.getStartCityCode()); // 区号 可空
        startAddress.put("adCode", schedule.getStartAdCode()); // 城市编码  可空
        startAddress.put("shortAddr", schedule.getStartShortAddr()); // 可空
        startAddress.put("poiName", ""); // 可空
        startAddress.put("poiId", "");
        startAddress.put("lon", schedule.getStartLon()); // 起点坐标 lon
        startAddress.put("poiFrom", "collectBar");
        startAddress.put("lat", schedule.getStartLat()); //起 点坐标 lat
        startAddress.put("longAddr", schedule.getStartLongAddr()); // 起点地址 可空
        startAddress.put("cityName", schedule.getStartCityName()); // 起点市的名 可空
        hashMap.put("startAddress", startAddress);

        hashMap.put("mobileSystem", "iOS 16.6");
        hashMap.put("SDKVersion", "3.4.7");
        hashMap.put("lon", schedule.getStartLon()); // 司机当前坐标lon
        hashMap.put("action", "hitch.driver.publishJourney");

        HashMap<String, Object> riskControlData = new HashMap<>();
        riskControlData.put("batteryLevel", "");
        riskControlData.put("openId", "");
        riskControlData.put("unionId", "");
        riskControlData.put("deviceLon", schedule.getStartLon()); // 司机当前坐标lon
        riskControlData.put("deviceLat", schedule.getStartLat()); // 司机当前坐标lat
        riskControlData.put("systemCode", "64");
        riskControlData.put("network", "wifi");
        hashMap.put("riskControlData", riskControlData);

        HashMap<String, Object> endAddress = new HashMap<>();
        endAddress.put("cityCode", schedule.getEndCityCode());
        endAddress.put("adCode", schedule.getEndAdCode());
        endAddress.put("shortAddr", schedule.getEndShortAddr());
        endAddress.put("poiName", "");
        endAddress.put("poiId", "");
        endAddress.put("lon", schedule.getEndLon()); // 行程终点 lon
        endAddress.put("poiFrom", "addrList");
        endAddress.put("lat", schedule.getEndLat()); // 行程终点 lat
        endAddress.put("longAddr", schedule.getEndLongAddr()); // 终点地址  可空 "南京市南京市-雨花台区-玉兰路98号南京南站"
        endAddress.put("cityName", schedule.getEndCityName());
        hashMap.put("endAddress", endAddress);

        hashMap.put("systemCode", "64");
        hashMap.put("version", "6.65.0");
        hashMap.put("ticket", Constant.MAIN_TICKET);
        hashMap.put("adCode", schedule.getStartAdCode()); // 司机当前城市编码 不可空
        hashMap.put("planStartTime", schedule.getTime()); // 发布的时间 必需 格式： "2024-06-20 14:10",
        hashMap.put("appName", "AppHitchDriverApplyWXMP");
        hashMap.put("seatCount", 4);
        hashMap.put("token", Constant.MAIN_TOKEN);
        hashMap.put("from", "weChat");
        hashMap.put("lat", schedule.getStartLat()); // 司机当前坐标lat
        hashMap.put("cityCode", schedule.getStartCityCode()); // 司机 当前城市 区号
        hashMap.put("releaseVersion", "6.65.0");
        hashMap.put("weChatVersion", "8.0.49");
        hashMap.put("addrSign", "");

        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, JSONObject.toJSONString(hashMap));
        // 创建请求对象，并添加自定义的请求头
        Request request = new Request.Builder()
                .url("https://taxiapi.hellobike.com/api?hitch.driver.publishJourney")
                .post(body)
                .addHeader("Host", "taxiapi.hellobike.com")
                .addHeader("Connection", "keep-alive")
                .addHeader("content-type", "application/json")
                .addHeader("Accept-Encoding", "gzip,compress,br,deflate")
                .addHeader("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.49(0x18003137) NetType/WIFI Language/zh_CN")
                .build();
        // 发送请求并获取响应
        Response response = null;
        try {
            response = client.newCall(request).execute();
            assert response.body() != null;
            JSONObject jsonObject = JSONObject.parseObject(response.body().string());
            assert jsonObject != null;
            String string = jsonObject.getString("code");
            if (jsonObject.getString("msg").equals("行程预计出发时间无效")) {
                Constant.handler.post(() -> {
                    DialogUtil.showDialog(Constant.context, "行程预计出发时间无效~");
                });
                return null;
            }
            if (string.equals("0")) {
                JSONObject result = JSONObject.parseObject(jsonObject.getString("data"));
                return result.getString("driverJourneyGuid");
            } else {
                return null;
            }
        } catch (IOException e) {
            return null;
        }
    }

    /**
     * @Deprecated 删除行程-小程序
     */
    public static String del_WeChatMini(String driverJourneyGuid) {
        OkHttpClient client = new OkHttpClient();
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("status", 10);
        hashMap.put("mobileModel", "");
        hashMap.put("cancelReason", "");
        hashMap.put("version", "6.65.0");
        HashMap<String, Object> riskControlData = new HashMap<>();
        riskControlData.put("batteryLevel", "76");
        riskControlData.put("openId", "");
        riskControlData.put("unionId", "");
        riskControlData.put("deviceLon", Constant.cityInfo.getLng());
        riskControlData.put("deviceLat", Constant.cityInfo.getLat());
        riskControlData.put("systemCode", "64");
        riskControlData.put("network", "wifi");
        hashMap.put("riskControlData", riskControlData);

        hashMap.put("releaseVersion", "6.65.0");
        hashMap.put("systemPlatform ", "ios");
        hashMap.put("from", "weChat");
        hashMap.put("ticket", Constant.MAIN_TICKET);
        hashMap.put("action", "hitch.driver.cancelOrder");
        hashMap.put("token", Constant.MAIN_TOKEN);
        hashMap.put("appName", "AppHitchDriverApplyWXMP");
        hashMap.put("SDKVersion", "3.4.7");
        hashMap.put("weChatVersion", "8.0.49");
        hashMap.put("systemCode", "64");
        hashMap.put("driverJourneyGuid", driverJourneyGuid);
        hashMap.put("mobileSystem", "iOS 16.6");
        MediaType mediaType = MediaType.parse("application/json");
        RequestBody body = RequestBody.create(mediaType, JSONObject.toJSONString(hashMap));
        // 创建请求对象，并添加自定义的请求头
        Request request = new Request.Builder()
                .url("https://taxiapi.hellobike.com/api?hitch.driver.cancelOrder")
                .post(body)
                .addHeader("Host", "taxiapi.hellobike.com")
                .addHeader("Connection", "keep-alive")
                .addHeader("content-type", "application/json")
                .addHeader("Accept-Encoding", "gzip,compress,br,deflate")
                .addHeader("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.49(0x18003137) NetType/WIFI Language/zh_CN")
                .build();
        // 发送请求并获取响应
        Response response = null;
        try {
            response = client.newCall(request).execute();
            assert response.body() != null;
            JSONObject jsonObject = JSONObject.parseObject(response.body().string());
            assert jsonObject != null;
            String string = jsonObject.getString("code");
            if (string.equals("0")) {
                return "0";
            } else {
                return jsonObject.getString("msg");
            }
        } catch (IOException e) {
            return null;
        }
    }

    private static String configureTasks() {
        String url = "http://103.36.167.125:81/hallo-api/initTxm";
        String result = null;
        try {
            result = HttpControllerUtil.doGet1(url);
        } catch (IOException e) {
            return null;
        }
        return result;
    }


    /**
     * @Deprecated 获取App大厅订单接口
     */
    public static void getWeChatAppProgramOrderList(CityInfo cityInfo, SynContainer synContainer, String name, int count) {
        if (Constant.isTxm) {
            return;

        }
        OkHttpClient client = new OkHttpClient();
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("action", "hitch.driver.journeyList");
        hashMap.put("clientId", ""); // 城市id
        hashMap.put("systemCode", "62"); // 系统代码
        hashMap.put("token", Constant.SON_TOKENS.get(count).getToken()); // 用户令牌
        hashMap.put("ticket", Constant.SON_TOKENS.get(count).getTicket()); // 用户标识 ticket
        hashMap.put("version", "6.76.5");

        hashMap.put("adCode", cityInfo.getAdCode()); // 城市邮编
        hashMap.put("cityCode", cityInfo.getCityId()); // 城市区号
        hashMap.put("lat", cityInfo.getLat()); //坐标 纬度
        hashMap.put("lon", cityInfo.getLng()); //坐标 经度
        hashMap.put("apkSignHash", "zkrFhoDpIPlkKlif+uTNtL1EYctTSHr7vJ/GE641gE4=\n");
        hashMap.put("bearHighwayFeeType", 0);
        hashMap.put("carpoolDeliverJointThreeOrders", false);
        hashMap.put("clickLat", "");
        hashMap.put("clickLon", "");
        hashMap.put("currentOrderGuids", new String[0]);
        hashMap.put("driverHomePageV2", false);
        hashMap.put("journeyType", 1);
        Integer[] journeyTypeList = {1};
        hashMap.put("journeyTypeList", journeyTypeList);

        hashMap.put("pageIndex", 1);//页面索引
        hashMap.put("pageSessionId", "");
        hashMap.put("pageSize", 10);
        hashMap.put("receivedPoolAgain", false);

        hashMap.put("requestSource", 0);
        hashMap.put("requestType", Constant.requestType);//获取类型 3=城际大厅 2=市内

        HashMap<String, Object> requestType3Param = new HashMap<>();
        requestType3Param.put("adCode", cityInfo.getAdCode());
        requestType3Param.put("cityCode", cityInfo.getCityId());

        requestType3Param.put("endAdCode", "");
        requestType3Param.put("endAdCodeList", new String[0]);

        requestType3Param.put("endCityCode", "");
        requestType3Param.put("endCityCodeList", "");
        if (!Constant.cityCodeList.isEmpty() && Constant.ZD_CS_CHECK) {
            requestType3Param.put("endCityCodeList", Constant.cityCodeList);
        }
        if (Constant.ZD_CS_CHECK && Constant.cityCodeList.isEmpty()) {
            return;
        }
        // 设置过滤器
        requestType3Param.put("filters", new String[0]);
        if (Constant.ZJ_DX) {
            ArrayList<FilterOrder> filterOrders = new ArrayList<>();
            FilterOrder filterOrder = new FilterOrder("0", "", "", "orderType");
            filterOrders.add(filterOrder);
            requestType3Param.put("filters", filterOrders);
        }
        if (Constant.YD_GS) {
            ArrayList<FilterOrder> filterOrders = new ArrayList<>();
            FilterOrder filterOrder = new FilterOrder("1", "", "", "bearHighWayFeeType");
            filterOrders.add(filterOrder);
            requestType3Param.put("filters", filterOrders);
        }
        if (Constant.ZJ_DX && Constant.YD_GS) {
            ArrayList<FilterOrder> filterOrders = new ArrayList<>();
            FilterOrder order = new FilterOrder("0", "", "", "orderType");
            FilterOrder gs = new FilterOrder("1", "", "", "bearHighWayFeeType");
            filterOrders.add(order);
            filterOrders.add(gs);
            requestType3Param.put("filters", filterOrders);
        }

        requestType3Param.put("lat", cityInfo.getLat());
        requestType3Param.put("lon", cityInfo.getLng());
        hashMap.put(Constant.requestTypeParam, requestType3Param); // 城际大厅 设置参数json

        hashMap.put("skipSourceType", 0);
        hashMap.put("sortMethod", Constant.SORT);//订单排序方式 1=智能 2=最早 3=最近 4=最高
        hashMap.put("timeRange", 0);
        hashMap.put("sid", "");

        HashMap<String, Object> riskControlData = new HashMap<>();
        riskControlData.put("deviceLat", Double.parseDouble(cityInfo.getLat()));
        riskControlData.put("deviceLon", Double.parseDouble(cityInfo.getLng()));
        riskControlData.put("systemCode", "62");
        riskControlData.put("network", "Wifi");
        riskControlData.put("mobileNoInfo", "");
        riskControlData.put("ssidName", "");
        riskControlData.put("capability", "WPA_PSK");
        riskControlData.put("roam", "");
        riskControlData.put("batteryLevel", "");
        riskControlData.put("isMock", 1);
        hashMap.put("riskControlData", riskControlData);
        MediaType mediaType = MediaType.parse("application/json");
        String encrypt = null;
        try {

            encrypt = Demo.encrypt(JSONObject.toJSONString(hashMap));
        } catch (Exception e) {
            Constant.handler.post(() -> DialogUtil.showDialog(Constant.context, e.getMessage()));
        }
        RequestBody body = RequestBody.create(mediaType, encrypt);
        // 创建请求对象，并添加自定义的请求头
        Request request = new Request.Builder()
                .url("https://taxiapi.hellobike.com/api")
                .post(body)
                .addHeader("Host", "taxiapi.hellobike.com")
                .addHeader("Connection", "keep-alive")
                .addHeader("content-type", "application/json; charset=UTF-8")
                .addHeader("user-agent", "Mozilla/5.0 (Linux; Android 13; 23049RAD8C Build/TKQ1.221114.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/127.0.6533.103 Mobile Safari/537.36")
                .addHeader("inner_action", "hitch.driver.journeyList")
                .addHeader("systemcode", "62")
                .addHeader("chaos", "true")
                .build();

        client.newCall(request).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                response = client.newCall(request).execute();
                assert response.body() != null;
                try {
                    String decrypt = Demo.decrypt(response.body().string());
                    JSONObject jsonObjectOne = JSONObject.parseObject(decrypt);
                    String status = jsonObjectOne.getString("code");
                    if (status.equals("0")) {
                        // todo 开始匹配条件
                        JSONObject jsonObject = JSONObject.parseObject(jsonObjectOne.toString());
                        JSONObject data = jsonObject.getJSONObject("data");
                        if (data == null) {
                            return;
                        }
                        JSONArray jsonArray = data.getJSONArray("list");
                        System.out.println("过检测小号:[" + Constant.SON_TOKENS.get(count).getToken() + "]获取到:" + jsonArray.size());

                        if (jsonArray.isEmpty()) {
                            LogManager.get().addLog("获取到0个订单");
                        }
                        {
                            LogManager.get().addLog(Constant.format.format(new Date()) + "模拟型号:" + Constant.model + " " + Constant.phone_version + "云端获取到:" + jsonArray.size() + "个订单\n");
                        }
                        for (Object o : jsonArray) {
                            JSONObject listData = JSONObject.parseObject(o.toString());
                            // 获取起点位置名称
                            JSONObject startAddress = listData.getJSONObject("startAddr");
                            JSONObject endAddress = listData.getJSONObject("endAddr");
                            // 金额判断(除100)
                            Integer price = listData.getInteger("price");
                            price = price / 100;
                            if (price <= Constant.MIN_MONEY || price >= Constant.MAX_MONEY) {
                                continue;
                            }

                            // 开始时间结束时间判断
                            Long startPlanStartTime = listData.getLong("startPlanStartTime");
                            Long endPlanStartTime = listData.getLong("endPlanStartTime");

                            Date startPlanStartTimeDate = DateUtil.passDate(DateUtil.LongTimeParseStingTime(startPlanStartTime));

                            Date endPlanStartTimeDate = DateUtil.passDate(DateUtil.LongTimeParseStingTime(endPlanStartTime));
                            // 订单开始时间小于自己设置的时间就跳出 after左边时间大于右边时间返回真
                            if (!startPlanStartTimeDate.after(Constant.START_TIME)) {
                                continue;
                            }
                            // 自己设置的结束时间小于订单结束时间就跳出
                            if (endPlanStartTimeDate.after(Constant.END_TIME)) {
                                continue;
                            }

                            // 订单类型
                            String carPoolText = listData.getString("carPoolText");

                            // 起点小于校验值判断
                            String startDistanceString = listData.getString("startDistance");
                            double startDistanceDouble = Double.parseDouble(startDistanceString);
                            startDistanceDouble = startDistanceDouble / 1000;
                            if (Double.parseDouble(Constant.MAX_STARTING_POINT_DISTANCE) < startDistanceDouble) {
                                continue;
                            }
                            // 终点小于校验值判断
                            String endDistanceString = listData.getString("distance");
                            double endDistanceDouble = Double.parseDouble(endDistanceString);
                            endDistanceDouble = endDistanceDouble / 1000;

                            // 获取乘坐人数
                            Integer passengerCount = listData.getInteger("passengerCount");
                            // 如果勾选了拼车开始进行拼车单校验
                            if (Constant.PC_PERSON_CHECKBOX && "拼座".equals(carPoolText)) {
                                if (passengerCount < Constant.PC_MIN_NUMBER || passengerCount > Constant.PC_MAX_NUMBER) {
                                    continue;
                                }
                            }
                            // 如果没有勾选但是单子是拼车直接跳出
                            if (!Constant.PC_PERSON_CHECKBOX && "拼座".equals(carPoolText)) {
                                continue;
                            }

                            // 如果勾选了独享开始进行独享单校验
                            if (Constant.DX_PERSON_CHECKBOX && "独享".equals(carPoolText)) {
                                if (passengerCount < Constant.DX_MIN_NUMBER || passengerCount > Constant.DX_MAX_NUMBER) {
                                    continue;
                                }
                            }
                            // 如果没有勾选但是单子是独享直接跳出
                            if (!Constant.DX_PERSON_CHECKBOX && "独享".equals(carPoolText)) {
                                continue;
                            }

                            // 如果勾选了舒适开始进行舒适单校验
                            if (Constant.SS_PERSON_CHECKBOX && !"独享".equals(carPoolText) && !"拼座".equals(carPoolText)) {
                                if (passengerCount < Constant.SS_MIN_NUMBER || passengerCount > Constant.SS_MAX_NUMBER) {
                                    continue;
                                }
                            }
                            // 如果没有勾选但是单子是适合拼直接跳出
                            if (!Constant.SS_PERSON_CHECKBOX && !"独享".equals(carPoolText) && !"拼座".equals(carPoolText)) {
                                continue;
                            }

                            // 开始计算单价金额
                            Double dj_money = price / endDistanceDouble;
                            NumberFormat nf = NumberFormat.getNumberInstance();
                            nf.setMaximumFractionDigits(2); // 设置最大小数位数为2
                            String formattedValue = nf.format(dj_money);
                            // 判断单价设置
                            if (Constant.DJ_CHECK) {
                                if (Double.parseDouble(formattedValue) < Constant.DJ_MIN_MONEY) {
                                    continue;
                                }
                            }
                            // todo 结束匹配条件

                            String shortAddress = startAddress.getString("shortAddr");
                            // 获取订单id
                            String journeyId = listData.getString("journeyId");

                            // 重复订单处理
                            if (Constant.stringBuilder.toString().contains(journeyId))
                                continue;
                            Constant.stringBuilder.append(journeyId).append(",");

                            // 判断排除地区
                            if (Constant.PC_CS_TEXT != null && Constant.PC_CS_CHECK) {
                                if (Constant.PC_CS_TEXT.contains(endAddress.getString("cityName"))) {
                                    continue;
                                }
                            }

                            // todo 匹配符合的生成订单类对象
                            SuccessOrder successOrder = new SuccessOrder();
                            successOrder.setShortAddr(shortAddress);
                            successOrder.setPassengerGuid(listData.getString("passengerGuid"));
                            successOrder.setPaxJourneyGuid(journeyId);
                            successOrder.setCityCode(startAddress.getString("cityCode"));
                            successOrder.setAdCode(startAddress.getString("adCode"));
                            successOrder.setLon(startAddress.getString("lon"));
                            successOrder.setLat(startAddress.getString("lat"));
                            successOrder.setSjLon(startAddress.getString("lon"));
                            successOrder.setSjLat(startAddress.getString("lat"));

                            successOrder.setPlanArriveTime(listData.getLong("planArriveTime"));
                            successOrder.setPrice(String.valueOf(price));
                            successOrder.setPersonNumber(String.valueOf(passengerCount));
                            successOrder.setOrderDes(String.valueOf(endDistanceDouble));
                            successOrder.setCarPoolText(carPoolText);
                            successOrder.setStartAddress(startAddress.getString("longAddr"));
                            successOrder.setEndAddress(endAddress.getString("longAddr"));
                            successOrder.setPassengerName(listData.getString("passengerName"));
                            successOrder.setAdName(startAddress.getString("adName"));
                            successOrder.setBizArea(startAddress.getString("bizArea"));
                            successOrder.setCityName(startAddress.getString("cityName"));
                            successOrder.setStartDes(String.valueOf(startDistanceDouble));
                            // 封装使用行程接单的参数
                            successOrder.setEndCityCode(endAddress.getString("cityCode"));
                            successOrder.setEndAdCode(endAddress.getString("adCode"));
                            successOrder.setEndShortAddr(endAddress.getString("shortAddr"));
                            successOrder.setEndLon(endAddress.getString("lon"));
                            successOrder.setEndLat(endAddress.getString("lat"));
                            successOrder.setEndLongAddr(endAddress.getString("longAddr"));
                            successOrder.setEndCityName(endAddress.getString("cityName"));
                            successOrder.setTime(listData.getString("startPlanStartTime"));
                            synContainer.setSuccessOrder(successOrder);
                        }
                    } else {
                        // 处理滑块
                        if (status.equals("99")) {
                            if (Constant.isTxm)
                                return;
                            Constant.isTxm = true;

                            Constant.handler.post(() -> {
                                DialogUtil.showDialog(Constant.context, "开始处理大厅图形验证中~");
                            });
                            JSONObject jsonObject = JSONObject.parseObject(jsonObjectOne.toString());
                            String data = jsonObject.getString("data");
                            if (Constant.NUMBER_BL > Constant.IP_SERVER.length) {
                                Constant.NUMBER_BL = 0;
                            }
                            String proxy = configureTasks();
                            Constant.handler.post(() -> {
                                DialogUtil.showDialog(Constant.context, "等待图形码结果~");
                            });
                            String sid = UUID.randomUUID().toString().replaceAll("-", "");
                            HashMap<String, String> hashMap1 = MyHttpUtil.initSlider(data, Constant.SON_TOKENS.get(count).getToken(), Constant.SON_TOKENS.get(count).getTicket(), sid);
                            if (hashMap1 == null) {
                                // 获取图形码服务器和处理图形码服务器
                                JSONObject fuck = MyHttpUtil.fuck();
                                String encrypt2 = "";
                                try {
                                    encrypt2 = Demo.encrypt(JSONObject.toJSONString(hashMap));
                                } catch (Exception e) {
                                    Constant.handler.post(() -> DialogUtil.showDialog(Constant.context, e.getMessage()));
                                }
                                MyHttpUtil.demo(encrypt2, Constant.SON_TOKENS.get(count).getToken(), Constant.SON_TOKENS.get(count).getTicket(), fuck);
                            }
                            // 获取图形码服务器和处理图形码服务器
                            JSONObject fuck = MyHttpUtil.fuck();
                            String txm = MyHttpUtil.txm(Constant.SON_TOKENS.get(count).getTicket(), Constant.SON_TOKENS.get(count).getToken(), data, proxy, fuck
                                    , hashMap1.get("challenge"), hashMap1.get("captchaId"), sid);

                        }

                        // 主号失败处理区
                        if (Constant.SON_TOKENS.get(count).getToken().equals(Constant.MAIN_TOKEN)) {
                            Constant.MAIN_ACCOUNT_STATUS = jsonObjectOne.getString("msg");
                            Constant.handler.post(() -> {
                                DialogUtil.showDialog(Constant.context, Constant.MAIN_ACCOUNT_STATUS);
                            });
                            if (Constant.MAIN_ERROR_NUMBER >= 5) {
                                // 设置状态
                                Constant.MAIN_ACCOUNT_STATUS = jsonObjectOne.getString("msg");
                                // 全局停止
                                Constant.isStart = false;
                                HomeFragment.updateStartCodeText("主号:" + jsonObjectOne.getString("msg"));
                            } else {
                                // 如果账号失效直接不递增全局结束
                                if (jsonObjectOne.getString("msg").equals("登录信息已失效, 请重新登录")) {
                                    Constant.MAIN_ACCOUNT_STATUS = jsonObjectOne.getString("msg");
                                    // 全局停止
                                    Constant.isStart = false;
                                    Constant.LX_QD = false;
                                    HomeFragment.updateStartCodeText("主号登录过期,去主号管理重新登录.");
                                } else {
                                    if (!jsonObjectOne.getString("msg").equals("外挂导致页面无法刷新，请卸载")) {
                                        Constant.MAIN_ERROR_NUMBER = Constant.MAIN_ERROR_NUMBER + 1;
                                    }
                                    System.out.println("主号失败信息:" + jsonObjectOne.getString("msg"));
                                }
                            }
                        } else {
                            // 小号失败处理区 每个小号有每个小号自己的失败次数
                            int errorNumber = Constant.SON_TOKENS.get(count).getErrorNumber();
                            if (errorNumber >= 5) {
                                // 设置状态
                                Constant.SON_TOKENS.get(count).setStatus(jsonObjectOne.getString("msg"));
                                // 赋值给回显
                                Constant.SON_TOKENS_SHOW = Constant.SON_TOKENS;
                                LogManager.get().addLog("小号" + Constant.SON_TOKENS.get(count).getDesc() + "异常:" + jsonObjectOne.getString("msg"));
                            } else {
                                // 小号失效则异步更新数据库
                                if (jsonObjectOne.getString("msg").equals("登录信息已失效, 请重新登录")) {
                                    LogManager.get().addLog("小号" + Constant.SON_TOKENS.get(count).getDesc() + "异常:" + "登录过期");
                                    // 设置状态
                                    Constant.SON_TOKENS.get(count).setStatus(jsonObjectOne.getString("msg"));
                                    // 赋值给回显
                                    Constant.SON_TOKENS_SHOW = Constant.SON_TOKENS;
                                    // 修改数据库状态
                                    new Thread(new Runnable() {
                                        @Override
                                        public void run() {
                                            MyHttpUtil.updateUserTokenStatus(Constant.SON_TOKENS.get(count));
                                        }
                                    }).start();
                                } else {
                                    if (!jsonObjectOne.getString("msg").equals("外挂导致页面无法刷新，请卸载")) {
                                        // 失败次数递增
                                        errorNumber = errorNumber + 1;
                                        Constant.SON_TOKENS.get(count).setErrorNumber(errorNumber);
                                    }
                                }
                            }
                        }
                    }
                } catch (Exception e) {
                    Constant.handler.post(() -> DialogUtil.showDialog(Constant.context, e.getMessage()));
                }
            }
        });

    }

    /**
     * @Deprecated 获取APP行程订单接口
     */
    public static void getWeChatAppXcOrderList(String driverJourneyId, CityInfo cityInfo, SynContainer synContainer, String name, int count) {
        OkHttpClient client = new OkHttpClient();
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("action", "hitch.driver.journeyListV2");
        hashMap.put("clientId", ""); // 城市id
        hashMap.put("systemCode", "62"); // 系统代码
        hashMap.put("token", Constant.MAIN_TOKEN); // 用户令牌
        hashMap.put("ticket", Constant.MAIN_TICKET); // 用户标识 ticket

        hashMap.put("version", Constant.HALLO_VERSION);

        hashMap.put("adCode", cityInfo.getAdCode()); // 城市邮编
        hashMap.put("cityCode", cityInfo.getCityId()); // 城市区号
        hashMap.put("lat", cityInfo.getLat()); //坐标 纬度
        hashMap.put("lon", cityInfo.getLng()); //坐标 经度

        hashMap.put("apkSignHash", "zkrFhoDpIPlkKlif+uTNtL1EYctTSHr7vJ/GE641gE4=\n");
        hashMap.put("bearHighwayFeeType", 0);
        hashMap.put("clickLat", "");
        hashMap.put("clickLon", "");
        hashMap.put("currentOrderGuids", new String[0]);
        //hashMap.put("driverJourneyId", driverJourneyId);
        hashMap.put("driverJourneyLineId", "");

        hashMap.put("journeyType", 1);
        Integer[] journeyTypeList = {1, 2};
        hashMap.put("journeyTypeList", journeyTypeList);

        hashMap.put("pageIndex", 1);//页面索引
        hashMap.put("pageSize", 10);

        hashMap.put("paxJourneyId", "");
        hashMap.put("receivedPoolAgain", false);

        hashMap.put("requestType", 1);//获取类型 3=城际大厅 2=市内
        HashMap<String, Object> requestType1Param = new HashMap<>();
        // 设置过滤器
        requestType1Param.put("driverJourneyId", driverJourneyId);
        hashMap.put("requestType1Param", requestType1Param); // app线程 设置参数json

        hashMap.put("skipSourceType", 0);
        hashMap.put("sortMethod", Constant.SORT);//订单排序方式 1=智能 2=最早 3=最近 4=最高
        hashMap.put("timeRange", 0);
        hashMap.put("sid", "");

        HashMap<String, Object> riskControlData = new HashMap<>();
        riskControlData.put("deviceLat", Double.parseDouble(cityInfo.getLat()));
        riskControlData.put("deviceLon", Double.parseDouble(cityInfo.getLng()));
        riskControlData.put("systemCode", "62");
        riskControlData.put("network", "wifi");
        riskControlData.put("mobileNoInfo", "");
        riskControlData.put("ssidName", "");
        riskControlData.put("capability", "");
        riskControlData.put("roam", "");
        riskControlData.put("batteryLevel", "");
        hashMap.put("riskControlData", riskControlData);
        MediaType mediaType = MediaType.parse("application/json");
        String encrypt = null;
        try {

            encrypt = Demo.encrypt(JSONObject.toJSONString(hashMap));
        } catch (Exception e) {
            Constant.handler.post(() -> DialogUtil.showDialog(Constant.context, e.getMessage()));
        }
        RequestBody body = RequestBody.create(mediaType, encrypt);
        // 创建请求对象，并添加自定义的请求头
        Request request = new Request.Builder()
                .url("https://taxiapi.hellobike.com/api")
                .post(body)
                .addHeader("Host", "taxiapi.hellobike.com")
                .addHeader("content-type", "application/json; charset=UTF-8")
                .addHeader("user-agent", "Mozilla/5.0 (Linux; Android 13; 23049RAD8C Build/TKQ1.221114.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/127.0.6533.103 Mobile Safari/537.36")
                .addHeader("inner_action", "hitch.driver.journeyList")
                .addHeader("systemcode", "62")
                .addHeader("chaos", "true")
                .build();

        client.newCall(request).enqueue(new Callback() {
            @Override
            public void onFailure(Call call, IOException e) {

            }

            @Override
            public void onResponse(Call call, Response response) throws IOException {
                response = client.newCall(request).execute();
                assert response.body() != null;
                try {
                    String decrypt = Demo.decrypt(response.body().string());
                    new Thread(new Runnable() {
                        @Override
                        public void run() {
                            JSONObject jsonObjectOne = JSONObject.parseObject(decrypt);
                            String status = jsonObjectOne.getString("code");
                            if (status.equals("0")) {
                                // todo 开始匹配条件
                                JSONObject jsonObject = JSONObject.parseObject(jsonObjectOne.toString());
                                JSONObject data = jsonObject.getJSONObject("data");
                                if (data == null) {
                                    return;
                                }
                                JSONArray jsonArray = data.getJSONArray("list");
                                if (jsonArray.isEmpty()) {
                                    LogManager.get().addLog("获取到0个订单");
                                }
                                {
                                    LogManager.get().addLog(Constant.format.format(new Date()) + "模拟型号:" + Constant.model + " " + Constant.phone_version + "云端行程获取到:" + jsonArray.size() + "个订单\n");
                                }
                                for (Object o : jsonArray) {
                                    JSONObject listData = JSONObject.parseObject(o.toString());
                                    // 获取起点位置名称
                                    JSONObject startAddress = listData.getJSONObject("startAddr");
                                    JSONObject endAddress = listData.getJSONObject("endAddr");
                                    // 金额判断(除100)
                                    Double price = listData.getDouble("price");
                                    price = price / 100;
                                    if (price <= Constant.MIN_MONEY || price >= Constant.MAX_MONEY) {
                                        continue;
                                    }

                                    // 开始时间结束时间判断
                                    Long startPlanStartTime = listData.getLong("startPlanStartTime");
                                    Long endPlanStartTime = listData.getLong("endPlanStartTime");

                                    Date startPlanStartTimeDate = DateUtil.passDate(DateUtil.LongTimeParseStingTime(startPlanStartTime));

                                    Date endPlanStartTimeDate = DateUtil.passDate(DateUtil.LongTimeParseStingTime(endPlanStartTime));
                                    // 订单开始时间小于自己设置的时间就跳出 after左边时间大于右边时间返回真
                                    if (!startPlanStartTimeDate.after(Constant.START_TIME)) {
                                        continue;
                                    }
                                    // 自己设置的结束时间小于订单结束时间就跳出
                                    if (endPlanStartTimeDate.after(Constant.END_TIME)) {
                                        continue;
                                    }

                                    // 订单类型
                                    String carPoolText = listData.getString("carPoolText");

                                    // 起点小于校验值判断
                                    String startDistanceString = listData.getString("startDistance");
                                    double startDistanceDouble = Double.parseDouble(startDistanceString);
                                    startDistanceDouble = startDistanceDouble / 1000;
                                    if (Double.parseDouble(Constant.MAX_STARTING_POINT_DISTANCE) < startDistanceDouble) {
                                        continue;
                                    }
                                    // 终点小于校验值判断
                                    String endDistanceString = listData.getString("endDistance");
                                    double endDistanceDouble = Double.parseDouble(endDistanceString);
                                    endDistanceDouble = endDistanceDouble / 1000;
                                    if (endDistanceDouble > Double.parseDouble(Constant.MAX_DESTINATION_DISTANCE)) {
                                        continue;
                                    }

                                    // 获取乘坐人数
                                    Integer passengerCount = listData.getInteger("passengerCount");
                                    // 如果勾选了拼车开始进行拼车单校验
                                    if (Constant.PC_PERSON_CHECKBOX && "拼座".equals(carPoolText)) {
                                        if (passengerCount < Constant.PC_MIN_NUMBER || passengerCount > Constant.PC_MAX_NUMBER) {
                                            continue;
                                        }
                                    }
                                    // 如果没有勾选但是单子是拼车直接跳出
                                    if (!Constant.PC_PERSON_CHECKBOX && "拼座".equals(carPoolText)) {
                                        continue;
                                    }

                                    // 如果勾选了独享开始进行独享单校验
                                    if (Constant.DX_PERSON_CHECKBOX && "独享".equals(carPoolText)) {
                                        if (passengerCount < Constant.DX_MIN_NUMBER || passengerCount > Constant.DX_MAX_NUMBER) {
                                            continue;
                                        }
                                    }
                                    // 如果没有勾选但是单子是独享直接跳出
                                    if (!Constant.DX_PERSON_CHECKBOX && "独享".equals(carPoolText)) {
                                        continue;
                                    }

                                    // 如果勾选了舒适开始进行舒适单校验
                                    if (Constant.SS_PERSON_CHECKBOX && !"独享".equals(carPoolText) && !"拼座".equals(carPoolText)) {
                                        if (passengerCount < Constant.SS_MIN_NUMBER || passengerCount > Constant.SS_MAX_NUMBER) {
                                            continue;
                                        }
                                    }
                                    // 如果没有勾选但是单子是适合拼直接跳出
                                    if (!Constant.SS_PERSON_CHECKBOX && !"独享".equals(carPoolText) && !"拼座".equals(carPoolText)) {
                                        continue;
                                    }

                                    // 开始计算单价金额
                                    Double dj_money = price / endDistanceDouble;
                                    NumberFormat nf = NumberFormat.getNumberInstance();
                                    nf.setMaximumFractionDigits(2); // 设置最大小数位数为2
                                    String formattedValue = nf.format(dj_money);
                                    // 判断单价设置
                                    if (Constant.DJ_CHECK) {
                                        if (Double.parseDouble(formattedValue) < Constant.DJ_MIN_MONEY) {
                                            continue;
                                        }
                                    }
                                    // todo 结束匹配条件

                                    String shortAddress = startAddress.getString("shortAddr");
                                    // 获取订单id
                                    String journeyId = listData.getString("journeyId");

                                    // 判断排除地区
                                    if (Constant.PC_CS_TEXT != null && Constant.PC_CS_CHECK) {
                                        if (Constant.PC_CS_TEXT.contains(endAddress.getString("cityName"))) {
                                            continue;
                                        }
                                    }

                                    // 判断顺路度
                                    Float hitchPercent = listData.getFloat("hitchPercent");
                                    float value = hitchPercent * 100;
                                    if (value < Float.parseFloat(Constant.scheduleSld)) {
                                        continue;
                                    }
                                    // 重复订单处理
                                    if (Constant.stringBuilder.toString().contains(journeyId))
                                        continue;
                                    Constant.stringBuilder.append(journeyId).append(",");

                                    // todo 匹配符合的生成订单类对象
                                    SuccessOrder successOrder = new SuccessOrder();
                                    successOrder.setShortAddr(shortAddress);
                                    successOrder.setPassengerGuid(listData.getString("passengerGuid"));
                                    successOrder.setPaxJourneyGuid(journeyId);
                                    successOrder.setCityCode(cityInfo.getCityId());
                                    successOrder.setAdCode(cityInfo.getAdCode());
                                    successOrder.setLon(startAddress.getString("lon"));
                                    successOrder.setLat(startAddress.getString("lat"));
                                    successOrder.setSjLon(cityInfo.getLng());
                                    successOrder.setSjLat(cityInfo.getLat());
                                    successOrder.setPlanArriveTime(listData.getLong("planArriveTime"));
                                    successOrder.setPrice(String.valueOf(price));
                                    successOrder.setPersonNumber(String.valueOf(passengerCount));
                                    successOrder.setOrderDes(String.valueOf(endDistanceDouble));
                                    successOrder.setCarPoolText(carPoolText);
                                    successOrder.setStartAddress(startAddress.getString("longAddr"));
                                    successOrder.setEndAddress(endAddress.getString("longAddr"));
                                    successOrder.setPassengerName(listData.getString("passengerName"));
                                    successOrder.setAdName(startAddress.getString("adName"));
                                    successOrder.setAdName(startAddress.getString("bizArea"));
                                    successOrder.setCityName(startAddress.getString("cityName"));
                                    successOrder.setStartDes(String.valueOf(startDistanceDouble));
                                    synContainer.setSuccessOrder(successOrder);
                                }
                            } else {
                                // 处理滑块
                                if (status.equals("99")) {
                                    if (Constant.isTxm)
                                        return;
                                    Constant.isTxm = true;

                                    Constant.handler.post(() -> {
                                        DialogUtil.showDialog(Constant.context, "开始处理大厅图形验证中~");
                                    });
                                    JSONObject jsonObject = JSONObject.parseObject(jsonObjectOne.toString());
                                    String data = jsonObject.getString("data");
                                    if (Constant.NUMBER_BL > Constant.IP_SERVER.length) {
                                        Constant.NUMBER_BL = 0;
                                    }
                                    String proxy = configureTasks();
                                    Constant.handler.post(() -> {
                                        DialogUtil.showDialog(Constant.context, "等待图形码结果~");
                                    });
                                    String sid = UUID.randomUUID().toString().replaceAll("-", "");
                                    HashMap<String, String> hashMap1 = MyHttpUtil.initSlider(data, Constant.SON_TOKENS.get(count).getToken(), Constant.SON_TOKENS.get(count).getTicket(), sid);
                                    if (hashMap1 == null) {
                                        // 获取图形码服务器和处理图形码服务器
                                        JSONObject fuck = MyHttpUtil.fuck();
                                        String encrypt2 = "";
                                        try {
                                            encrypt2 = Demo.encrypt(JSONObject.toJSONString(hashMap));
                                        } catch (Exception e) {
                                            Constant.handler.post(() -> DialogUtil.showDialog(Constant.context, e.getMessage()));
                                        }
                                        MyHttpUtil.demo(encrypt2,Constant.SON_TOKENS.get(count).getToken(),Constant.SON_TOKENS.get(count).getTicket(),fuck);
                                    }
                                    // 获取图形码服务器和处理图形码服务器
                                    JSONObject fuck = MyHttpUtil.fuck();
                                    String txm = MyHttpUtil.txm(Constant.SON_TOKENS.get(count).getTicket(), Constant.SON_TOKENS.get(count).getToken(), data, proxy, fuck
                                            , hashMap1.get("challenge"), hashMap1.get("captchaId"), sid);
                                }

                                // 主号失败处理区
                                if (Constant.SON_TOKENS.get(count).getToken().equals(Constant.MAIN_TOKEN)) {
                                    Constant.MAIN_ACCOUNT_STATUS = jsonObjectOne.getString("msg");
                                    Constant.handler.post(() -> {
                                        DialogUtil.showDialog(Constant.context, Constant.MAIN_ACCOUNT_STATUS);
                                    });
                                    if (Constant.MAIN_ERROR_NUMBER >= 5) {
                                        // 设置状态
                                        Constant.MAIN_ACCOUNT_STATUS = jsonObjectOne.getString("msg");
                                        // 全局停止
                                        Constant.isStart = false;
                                        HomeFragment.updateStartCodeText("主号:" + jsonObjectOne.getString("msg"));
                                    } else {
                                        // 如果账号失效直接不递增全局结束
                                        if (jsonObjectOne.getString("msg").equals("登录信息已失效, 请重新登录")) {
                                            Constant.MAIN_ACCOUNT_STATUS = jsonObjectOne.getString("msg");
                                            // 全局停止
                                            Constant.isStart = false;
                                            Constant.LX_QD = false;
                                            HomeFragment.updateStartCodeText("主号登录过期,去主号管理重新登录.");
                                        } else {
                                            if (!jsonObjectOne.getString("msg").equals("外挂导致页面无法刷新，请卸载")) {
                                                Constant.MAIN_ERROR_NUMBER = Constant.MAIN_ERROR_NUMBER + 1;
                                            }
                                            System.out.println("主号失败信息:" + jsonObjectOne.getString("msg"));
                                        }
                                    }
                                } else {
                                    // 小号失败处理区 每个小号有每个小号自己的失败次数
                                    int errorNumber = Constant.SON_TOKENS.get(count).getErrorNumber();
                                    if (errorNumber >= 5) {
                                        // 设置状态
                                        Constant.SON_TOKENS.get(count).setStatus(jsonObjectOne.getString("msg"));
                                        // 赋值给回显
                                        Constant.SON_TOKENS_SHOW = Constant.SON_TOKENS;
                                        LogManager.get().addLog("小号" + Constant.SON_TOKENS.get(count).getDesc() + "异常:" + jsonObjectOne.getString("msg"));
                                    } else {
                                        // 小号失效则异步更新数据库
                                        if (jsonObjectOne.getString("msg").equals("登录信息已失效, 请重新登录")) {
                                            LogManager.get().addLog("小号" + Constant.SON_TOKENS.get(count).getDesc() + "异常:" + "登录过期");
                                            // 设置状态
                                            Constant.SON_TOKENS.get(count).setStatus(jsonObjectOne.getString("msg"));
                                            // 赋值给回显
                                            Constant.SON_TOKENS_SHOW = Constant.SON_TOKENS;
                                            // 修改数据库状态
                                            new Thread(new Runnable() {
                                                @Override
                                                public void run() {
                                                    MyHttpUtil.updateUserTokenStatus(Constant.SON_TOKENS.get(count));
                                                }
                                            }).start();
                                        } else {
                                            if (!jsonObjectOne.getString("msg").equals("外挂导致页面无法刷新，请卸载")) {
                                                // 失败次数递增
                                                errorNumber = errorNumber + 1;
                                                Constant.SON_TOKENS.get(count).setErrorNumber(errorNumber);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }).start();
                } catch (Exception e) {
                    Constant.handler.post(() -> DialogUtil.showDialog(Constant.context, e.getMessage()));
                }
            }
        });
    }

    /**
     * @Deprecated 执行App接单
     */
    public static void submitWeChatAppOrder(SuccessOrder successOrder) {
        OkHttpClient client = new OkHttpClient();
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("action", "hitch.driver.receiveOrder");
        hashMap.put("clientId", "");
        hashMap.put("systemCode", "62");

        hashMap.put("ticket", Constant.MAIN_TICKET);
        hashMap.put("token", Constant.MAIN_TOKEN);

        hashMap.put("version", "6.76.5");

        hashMap.put("adCode", Constant.cityInfo.getAdCode());
        hashMap.put("cityCode", Constant.cityInfo.getCityId());
        hashMap.put("lat", successOrder.getLat());
        hashMap.put("lon", successOrder.getLon());

        hashMap.put("apkSignHash", "zkrFhoDpIPlkKlif+uTNtL1EYctTSHr7vJ/GE641gE4=\n");
        hashMap.put("bounty", 0);
        hashMap.put("bountyGuid", "");

        HashMap<String, Object> driverStartAddress = new HashMap<>();
        driverStartAddress.put("adCode", Constant.cityInfo.getAdCode());
        driverStartAddress.put("adName", successOrder.getAdName());
        driverStartAddress.put("addrType", 0);
        driverStartAddress.put("bizArea", successOrder.getBizArea());
        driverStartAddress.put("cityCode", successOrder.getCityCode());
        driverStartAddress.put("cityName", successOrder.getCityName());
        driverStartAddress.put("lat", successOrder.getLat());
        driverStartAddress.put("lon", successOrder.getLon());
        driverStartAddress.put("longAddr", successOrder.getStartAddress());
        driverStartAddress.put("poiId", "");
        driverStartAddress.put("poiInfo", "");
        driverStartAddress.put("recommend", false);
        driverStartAddress.put("shortAddr", successOrder.getShortAddr());
        driverStartAddress.put("source", 0);
        driverStartAddress.put("streetInfo", "");
        hashMap.put("driverStartAddress", driverStartAddress);

        hashMap.put("hitchPercent", "0.99");
        hashMap.put("invalidOrderGreyResult", false);
        hashMap.put("paxJourneyGuid", successOrder.getPaxJourneyGuid());
        hashMap.put("passengerGuid", successOrder.getPassengerGuid());
        if (successOrder.getDriverJourneyGuid() != null) {
            hashMap.put("driverJourneyGuid", successOrder.getDriverJourneyGuid());
        }

        hashMap.put("planArriveTime", "");
        hashMap.put("receiveOrderDriverSourceType", 0);
        hashMap.put("receiveSourceType", 7);
        hashMap.put("relativeFriend", 0);
        hashMap.put("sourceType", 1);
        hashMap.put("totalBounty", 0);
        hashMap.put("useDefaultVehicle", false);
        hashMap.put("sid", "");

        HashMap<String, Object> riskControlData = new HashMap<>();
        riskControlData.put("deviceLat", successOrder.getLat());
        riskControlData.put("deviceLon", successOrder.getLon());
        riskControlData.put("systemCode", "62");
        riskControlData.put("network", "wifi");
        riskControlData.put("mobileNoInfo", "");
        riskControlData.put("ssidName", "");
        riskControlData.put("capability", "");
        riskControlData.put("roam", "");
        riskControlData.put("batteryLevel", "");

        hashMap.put("riskControlData", riskControlData);
        MediaType mediaType = MediaType.parse("application/json");
        String encrypt = null;
        try {
            encrypt = Demo.encrypt(JSONObject.toJSONString(hashMap));
        } catch (Exception e) {
            e.printStackTrace();
        }
        RequestBody body = RequestBody.create(mediaType, encrypt);
        // 创建请求对象，并添加自定义的请求头
        Request request = new Request.Builder()
                .url("https://taxiapi.hellobike.com/api")
                .post(body)
                .addHeader("Host", "taxiapi.hellobike.com")
                .addHeader("content-type", "application/json; charset=UTF-8")
                .addHeader("user-agent", "Mozilla/5.0 (Linux; Android 13; 23049RAD8C Build/TKQ1.221114.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/127.0.6533.103 Mobile Safari/537.36")
                .addHeader("inner_action", "hitch.driver.journeyList")
                .addHeader("systemcode", "62")
                .addHeader("chaos", "true")
                .build();
        // 发送请求并获取响应
        Response response = null;
        try {
            response = client.newCall(request).execute();
            String decrypt = Demo.decrypt(response.body().string());
            JSONObject jsonObjectOne = JSONObject.parseObject(decrypt);
            String status = jsonObjectOne.getString("code");
            // 失败消息
            String msg = null;
            JSONObject data = jsonObjectOne.getJSONObject("data");
            if (status.equals("100000")) {
                JSONObject commonAlert = data.getJSONObject("commonAlert");
                // 拼接信息
                String title = commonAlert.getJSONObject("title").getString("text");
                String content = commonAlert.getJSONObject("content").getString("text");
                msg = title + ":" + content;
            }
            if (data != null) {
                if (status.equals("0") && data.getBoolean("joinPkSuccess")) {
                    msg = "成功加入PK." + "瞬移定位为:" + successOrder.getShortAddr();
                } else {
                    JSONObject commonAlert = data.getJSONObject("commonAlert");
                    // 拼接信息
                    String title = commonAlert.getJSONObject("title").getString("text");
                    String content = commonAlert.getJSONObject("content").getString("text");
                    msg = title + ":" + content;
                }
            }
            if (status.equals("880")) {
                msg = "此订单已加入PK";
            }
            if (status.equals("865")) {
                msg = "成功加入PK";
            }
            if (status.equals("10000")) {
                msg = "APP未刷脸认证";
                Constant.isStart = false;
                Constant.LX_QD = false;
            }
            if (status.equals("103")) {
                msg = "主号登录过期";
                Constant.isStart = false;
                Constant.LX_QD = false;
                LogManager.get().stopLog();
            }
            // 取消抢单
            if (!Constant.mediaPlayer.isPlaying()) {
                Constant.mediaPlayer.start();
            }
            LogManager.get().addLog(msg);
            HomeFragment.updateStartCodeText(msg);
            successOrder.setOrderType("APP");
            // 插入数据库
            String finalMsg = msg;
            new Thread(() -> MyHttpUtil.addUserOrder(successOrder)).start();
        } catch (Exception e) {

            Constant.handler.post(() -> DialogUtil.showDialog(Constant.context, "您绑定了两个车无法接单,请进行解绑一个车"));
        }
    }


    /***
     * @Deprecated 获取自己接的订单和自己发布的行程订单
     */
    public static String getWeChatMiniMyOrderOrMyScheduleOrder() {
        OkHttpClient client = new OkHttpClient();
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("systemPlatform", "ios");
        hashMap.put("mobileModel", "");
        hashMap.put("mobileSystem", "iOS 16.6");
        hashMap.put("SDKVersion", "3.4.4");
        hashMap.put("action", "hitch.core.checkJourneyListV2");
        hashMap.put("lon", Constant.cityInfo.getLng());// 经度

        HashMap<String, Object> riskControlData = new HashMap<>();
        riskControlData.put("batteryLevel", "48");
        riskControlData.put("openId", "");
        riskControlData.put("unionId", "");
        riskControlData.put("deviceLon", Constant.cityInfo.getLng()); // 经度
        riskControlData.put("deviceLat", Constant.cityInfo.getLat()); // 纬度
        riskControlData.put("systemCode", "64");
        riskControlData.put("network", "wifi");
        hashMap.put("riskControlData", riskControlData);

        hashMap.put("systemCode", "64");
        hashMap.put("version", "6.68.0");
        hashMap.put("ticket", Constant.MAIN_TICKET);


        hashMap.put("journeyTypeList", "");

        hashMap.put("adCode", Constant.cityInfo.getAdCode());// 邮编
        hashMap.put("appName", "AppHitchDriverApplyWXMP");
        hashMap.put("token", Constant.MAIN_TOKEN);
        hashMap.put("userNewId", null);
        hashMap.put("from", "weChat");
        hashMap.put("cityCode", Constant.cityInfo.getCityId()); // 区号
        hashMap.put("lat", Constant.cityInfo.getLat());// 纬度
        hashMap.put("releaseVersion", "6.63.0");
        hashMap.put("weChatVersion", "8.0.49");
        MediaType mediaType = MediaType.parse("application/json");
        String jsonString = JSONObject.toJSONString(hashMap);
        RequestBody body = RequestBody.create(mediaType, jsonString);
        // 创建请求对象，并添加自定义的请求头
        Request request = new Request.Builder()
                .url("https://taxiapi.hellobike.com/api?hitch.core.checkJourneyListV2")
                .post(body)
                .addHeader("Host", "taxiapi.hellobike.com")
                .addHeader("Connection", "keep-alive")
                .addHeader("content-type", "application/json")
                .addHeader("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.49(0x1800312d) NetType/WIFI Language/zh_CN")
                .build();
        // 发送请求并获取响应
        Response response = null;
        try {
            response = client.newCall(request).execute();

            assert response.body() != null;
            JSONObject jsonObject = JSONObject.parseObject(response.body().string());
            assert jsonObject != null;
            String status = jsonObject.getString("code");
            if (status.equals("0")) {
                return jsonObject.toString();
            } else {
                return jsonObject.getString("msg");
            }
        } catch (IOException e) {
            return null;
        }
    }

    /**
     * @return
     * @Deprecated 获取自己PK成功的所有订单
     */
    public static JSONObject getSuccessOrder() {
        OkHttpClient client = new OkHttpClient();
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("systemPlatform", "ios");
        hashMap.put("mobileModel", "");
        hashMap.put("mobileSystem", "iOS 16.6");
        hashMap.put("SDKVersion", "3.4.4");
        hashMap.put("action", "hitch.core.checkJourneyListV2");
        hashMap.put("lon", Constant.cityInfo.getLng());// 经度

        HashMap<String, Object> riskControlData = new HashMap<>();
        riskControlData.put("batteryLevel", "48");
        riskControlData.put("openId", "");
        riskControlData.put("unionId", "");
        riskControlData.put("deviceLon", Constant.cityInfo.getLng()); // 经度
        riskControlData.put("deviceLat", Constant.cityInfo.getLat()); // 纬度
        riskControlData.put("systemCode", "64");
        riskControlData.put("network", "wifi");
        hashMap.put("riskControlData", riskControlData);

        hashMap.put("systemCode", "64");
        hashMap.put("version", "6.68.0");
        hashMap.put("ticket", Constant.MAIN_TICKET);


        hashMap.put("journeyTypeList", "");

        hashMap.put("adCode", Constant.cityInfo.getAdCode());// 邮编
        hashMap.put("appName", "AppHitchDriverApplyWXMP");
        hashMap.put("token", Constant.MAIN_TOKEN);
        hashMap.put("userNewId", null);
        hashMap.put("from", "weChat");
        hashMap.put("cityCode", Constant.cityInfo.getCityId()); // 区号
        hashMap.put("lat", Constant.cityInfo.getLat());// 纬度
        hashMap.put("releaseVersion", "6.63.0");
        hashMap.put("weChatVersion", "8.0.49");
        MediaType mediaType = MediaType.parse("application/json");
        String jsonString = JSONObject.toJSONString(hashMap);
        RequestBody body = RequestBody.create(mediaType, jsonString);
        // 创建请求对象，并添加自定义的请求头
        Request request = new Request.Builder()
                .url("https://taxiapi.hellobike.com/api?hitch.core.checkJourneyListV2")
                .post(body)
                .addHeader("Host", "taxiapi.hellobike.com")
                .addHeader("Connection", "keep-alive")
                .addHeader("content-type", "application/json")
                .addHeader("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.49(0x1800312d) NetType/WIFI Language/zh_CN")
                .build();
        // 发送请求并获取响应
        Response response = null;
        try {
            response = client.newCall(request).execute();

            assert response.body() != null;
            JSONObject jsonObject = JSONObject.parseObject(response.body().string());
            assert jsonObject != null;
            String status = jsonObject.getString("code");
            if (status.equals("0")) {
                return jsonObject;
            } else {
                return jsonObject;
            }
        } catch (IOException e) {
            return null;
        }
    }

    /**
     * @Deprecated 获取Pk信息
     */
    public static String getPkInfo(String orderId) {
        OkHttpClient client = new OkHttpClient();
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("action", "hitch.driver.preJourneyDetailV2");
        hashMap.put("clientId", "");
        hashMap.put("systemCode", "62");
        hashMap.put("ticket", Constant.MAIN_TICKET);
        hashMap.put("token", Constant.MAIN_TOKEN);
        hashMap.put("version", Constant.HALLO_VERSION);
        hashMap.put("adCode", Constant.cityInfo.getAdCode());
        hashMap.put("cityCode", Constant.cityInfo.getCityId());
        hashMap.put("lat", Constant.cityInfo.getLat());
        hashMap.put("lon", Constant.cityInfo.getLng());
        hashMap.put("endDistance", "");
        hashMap.put("enumPreJourneyDetailType", 6);
        hashMap.put("passengerJourneyGuid", orderId);
        hashMap.put("skipSourceType", 0);
        hashMap.put("startDistance", 100);
        hashMap.put("sid", "");
        MediaType mediaType = MediaType.parse("application/json");
        String encrypt = null;
        try {
            encrypt = Demo.encrypt(JSONObject.toJSONString(hashMap));
        } catch (Exception e) {
            Constant.handler.post(() -> DialogUtil.showDialog(Constant.context, e.getMessage()));
        }
        RequestBody body = RequestBody.create(mediaType, encrypt);
        // 创建请求对象，并添加自定义的请求头
        Request request = new Request.Builder()
                .url("https://taxiapi.hellobike.com/api")
                .post(body)
                .addHeader("Host", "taxiapi.hellobike.com")
                .addHeader("user-agent", "Mozilla/5.0 (Linux; Android 8.1.0; Redmi 5 Build/OPM1.171019.026; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/71.0.3578.99 Mobile Safari/537.36")
                .addHeader("inner_action", "hitch.driver.preJourneyDetailV2")
                .addHeader("systemcode", "62")
                .addHeader("chaos", "true")
                .addHeader("content-type", "application/json; charset=UTF-8")
                .build();
        // 发送请求并获取响应
        Response response = null;
        try {
            response = client.newCall(request).execute();
            String decrypt = Demo.decrypt(response.body().string());
            JSONObject jsonObjectOne = JSONObject.parseObject(decrypt);
            return jsonObjectOne.getString("code");
        } catch (Exception e) {
            return null;
        }
    }


}
